package main

import (
	"fmt"
	"net/http"
	"os"

	"golang.org/x/net/html"
)

func main() {
	for _, arg := range os.Args[1:] {
		links, err := findlinks(arg)
		if err != nil {

		}
		for _, link := range links {
			fmt.Println(link)
		}
	}
}

func findlinks(url string) ([]string, error) {
	resp, err := http.Get(url)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != http.StatusOK {
		resp.Body.Close()

	}

	doc, err := html.Parse(resp.Body)
	resp.Body.Close()
	if err != nil {

	}
	return visit(nil, doc), nil

}
